import service from '@/utils/request'

const url = {
  //获取求助列表
  getList: '/help/list',
  //发布、修改学术求助
  saveHelp: '/help/create',
  //获取求助详情
  getDetail: '/help/detail',
  //删除学术求助
  deleteHelp: '/help/delete',
  //收藏问题
  likeHelp: '/help/like',
  //回复
  reply: '/help/reply',
  //采纳
  bestAnswer: '/help/best',
  //获取提及某个文章的问题
  getMention: '/help/mention'
}

export const Help = {
  getList: function (params) {
    return service({
      url: url.getList,
      method: 'get',
      params
    })
  },
  saveHelp: function (data) {
    return service({
      url: url.saveHelp,
      method: 'post',
      data
    })
  },
  getDetail: function (data) {
    return service({
      url: url.getDetail,
      method: 'post',
      data
    })
  },
  deleteHelp: function (data) {
    return service({
      url: url.deleteHelp,
      method: 'post',
      data
    })
  },
  likeHelp: function (data) {
    return service({
      url: url.likeHelp,
      method: 'post',
      data
    })
  },
  reply: function (data) {
    return service({
      url: url.reply,
      method: 'post',
      data
    })
  },
  bestAnswer: function (data) {
    return service({
      url: url.bestAnswer,
      method: 'post',
      data
    })
  },
  getMention: function (data) {
    return service({
      url: url.getMention,
      method: 'post',
      data
    })
  }
}
